package com.xuxin.baby.adapter;

import android.widget.ImageView;

import com.blankj.utilcode.util.LogUtils;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.baby.R;
import com.xuxin.baby.bean.UserLikeBean;
import com.xuxin.baby.glide.GlideApp;
import com.xuxin.baby.network.Retrofit;

import org.jetbrains.annotations.NotNull;

/**
 * Created by xu_xin
 * Created on 2020.08.28 0028
 * 视频文章
 */
public class UserLikeAdapter extends BaseQuickAdapter<UserLikeBean.ResultBean.ItemsBean, BaseViewHolder> {
    RequestOptions options = new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10));

    public UserLikeAdapter() {
        super(R.layout.item_video);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, UserLikeBean.ResultBean.ItemsBean itemsBean) {
        holder.setText(R.id.item_video_name, itemsBean.getTCourse().getTitle());
        holder.setText(R.id.item_video_content, itemsBean.getTCourse().getSummary());
        /**
         * 加载图片
         */
        ImageView item_video_image = holder.getView(R.id.item_video_image);
        String videoImage = Retrofit.image_url + itemsBean.getTCourse().getImageUrl();
        LogUtils.e("收藏视频_image = " + videoImage);
        GlideApp.with(getContext()).load(videoImage).placeholder(R.mipmap.img_placeholder260).apply(options).into(item_video_image);
    }
}